<template>
  <div class="mianbaoxie">
    <el-breadcrumb separator-class="el-icon-arrow-right" v-if="arr.length">
      <el-breadcrumb-item :to="{ path: '/Welcome' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item v-for="(item,i) in arr" :key="i">{{item}}</el-breadcrumb-item>
    </el-breadcrumb>
  </div>
</template>

<script>
import { left } from "@/ulits/api/Welcome/jurisdiction";
export default {
  name: "mianbaoxie",
  data() {
    return {
      arr: [],
    };
  },
  async created() {
    let data;
    var id;
    await left().then((res) => {
      res.data.forEach((element) => {
        element.children.forEach((item) => {
          if (item.path === this.$route.name) {
            data = item;
          }
        });
      });
      let flag = false;
      res.data.forEach((element) => {
        element.children.forEach((item) => {
          if (item.id == data.id) {
            flag = true;
            return;
          }
        });
        if (flag) {
          id = element;
          flag = false;
        }
      });
      // console.log(id);
      // console.log(data);
      this.arr.push(id.authName);
      this.arr.push(data.authName);
    });
  },
};
</script>

<style lang="scss" scoped>
.mianbaoxie {
  margin-bottom: 15px;
}
</style>